package com.ken.apollo.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 联系咨询实体类
 *
 * @author Ken
 * @since 2024-01-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("contact_inquiry")
public class ContactInquiry implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 名字
     */
    @TableField("first_name")
    private String firstName;

    /**
     * 姓氏
     */
    @TableField("last_name")
    private String lastName;

    /**
     * 邮箱地址
     */
    @TableField("email")
    private String email;

    /**
     * 电话号码
     */
    @TableField("phone")
    private String phone;

    /**
     * 公司/组织
     */
    @TableField("company")
    private String company;

    /**
     * 主题类型
     * sales-销售咨询，technical-技术支持，quote-报价请求，
     * demo-产品演示，partnership-合作伙伴，other-其他
     */
    @TableField("subject")
    private String subject;

    /**
     * 留言内容
     */
    @TableField("message")
    private String message;

    /**
     * 是否订阅新闻通讯
     * 0-否，1-是
     */
    @TableField("newsletter")
    private Boolean newsletter;

    /**
     * 处理状态
     * pending-待处理，processing-处理中，completed-已完成，closed-已关闭
     */
    @TableField("status")
    private String status;

    /**
     * 提交者IP地址
     */
    @TableField("ip_address")
    private String ipAddress;

    /**
     * 用户代理信息
     */
    @TableField("user_agent")
    private String userAgent;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 联系咨询状态枚举
     */
    public enum Status {
        PENDING("pending", "待处理"),
        PROCESSING("processing", "处理中"),
        COMPLETED("completed", "已完成"),
        CLOSED("closed", "已关闭");

        private final String code;
        private final String description;

        Status(String code, String description) {
            this.code = code;
            this.description = description;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 主题类型枚举
     */
    public enum Subject {
        SALES("sales", "销售咨询"),
        TECHNICAL("technical", "技术支持"),
        QUOTE("quote", "报价请求"),
        DEMO("demo", "产品演示"),
        PARTNERSHIP("partnership", "合作伙伴"),
        OTHER("other", "其他");

        private final String code;
        private final String description;

        Subject(String code, String description) {
            this.code = code;
            this.description = description;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }
}
